﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data.OleDb;
using System.Data;


namespace WinCrystalReports
{
    public static class ContactoDAL
    {

        public static dtoContactosEmpresa GetContactosEmpresa()
        {
            dtoContactosEmpresa dtContactosEmpresa = new dtoContactosEmpresa();

 
            using (OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
            {

                #region Cargo Datos Empresa

                string sql = @"SELECT IdEmpresa
                                  ,RazonSocial
                                  ,Telefono
                                  ,Direccion
                                  ,CUIT
                              FROM Empresas";

                OleDbCommand command = new OleDbCommand(sql, conn);

                OleDbDataAdapter da = new OleDbDataAdapter(command);

                da.Fill(dtContactosEmpresa, "DatosEmpresa");

                #endregion

                #region Cargo Contactos

                sql = @"SELECT Nombre
                          ,Apellido
                          ,FechaNacimiento
                          ,Localidad
                          ,Calle
                          ,Numero
                          ,Mail
                      FROM Contacto";


                command = new OleDbCommand(sql, conn);

                da = new OleDbDataAdapter(command);

                da.Fill(dtContactosEmpresa, "Contactos");

                #endregion

            }

            return dtContactosEmpresa;
        }



    }
}
